<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<jsp:directive.page import="com.anhry.app.safety.util.Util"/>
<%@ include file="/WEB-INF/pages/share/taglib.jsp"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>企业属地调整</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link href="<%=basePath+Util.SKIN%>/css/right.css" type="text/css" rel="stylesheet">
	<script type="text/javascript" src="<%=basePath%>/js/jquery-1.7.2.js"></script>
	<script type="text/javascript" src="<%=basePath%>/js/dbdialog/lhgdialog.min.js<%=Util.LHGDIALOG%>"></script>
	<script type="text/javascript" src="<%=basePath%>/js/check_jquery.js"></script>
	<script type="text/javascript" src="<%=path%>/js/selected.js"></script>
	<script type="text/javascript" src="<%=path%>/js/util.js"></script>
	
	<script type="text/javascript">
		$(function(){
			initSelArray('unitId:1','deptId:1');
			var cCounty = '${corp.tbCounty.id}';
			var cUnit = '${corp.tbStreet.id}';
			var cDept = '${corp.tbVillage.id}';
			if(null!=cCounty && cCounty!=""){
				changeCounty(cCounty);
			}
	   		if(cUnit!=null && cUnit!=""){
	   			changeUnit(cUnit);
	   			selected('unitId',cUnit);	//加载选中项
	   		}
	   		if(cDept!=null && cDept!=""){
	   			selected('deptId',cDept);	//加载选中项
	   		}
		});
		function changeCounty(cid){
	   		var urls='<%=basePath%>/util/data_getDept.action?cUnit='+cid+"&cCounty=1";
	   		buildSelect(cid, 'unitId',urls,'1');
	   	}
	   	function changeUnit(uid){
	   		var urls="<%=basePath%>/util/data_getDept.action?cUnit="+uid;
	   		buildSelect(uid, 'deptId',urls,'1');
	   	}
	  	function fnSearch(){
	  		var api = frameElement.api, W = api.opener;
		  	W.form1.submit();
      	}
      	function fnSubmit(){
	    	var type1 = document.getElementById('bselect1').value;
	    	var type2 = document.getElementById('bselect2').value;
	   		if(type1==null || type1=="" || type2==null || type2==""){
	   			msgDialog('请选择企业属地信息！', 'alert.gif');
	   			return false;
	   		}
	   		return true;
      	}
	</script>
	<style>
		* html body {padding:0px 0px 6px 0px;}
		.menuitem {float:left;POSITION: absolute; VISIBILITY: hidden;}
		.menuitem1 {float:left;POSITION: static; VISIBILITY: visible;}
	</style>
  </head>
  
  <body>
	<div  class="body-box">
		<div id="container">
			<form action="<%=basePath%>/enterprise/con_corpSdSet.action" method="post" name="form1">
		    	<table border="0" cellpadding="0" cellspacing="0" class="mytable">
			   		<thead>
				    	<tr class="fixedHeaderTr">
				     		<th>${corp.corpName }</th>
				    	</tr>
			   		</thead>
				   	<tbody>
				   		<tr>
				     		<td align="center">
					     		<s:select list="sdList" name="countyId" value="%{corp.tbCounty.id }" listKey="id" listValue="deptName" headerKey="" headerValue="请选择" theme="simple" cssStyle="width:155px;margin-left:5px;" id="bselect1" onchange="changeCounty(this.value);"></s:select><SPAN class="note4">*</SPAN>
				   			<s:select list="#{}" name="unitId" headerKey="" headerValue="请选择" theme="simple" cssStyle="width:155px;margin-left:5px;" id="bselect2" onchange="changeUnit(this.value);"></s:select><SPAN class="note4">*</SPAN>
				   			<s:select list="#{}" name="deptId" headerKey="" headerValue="请选择" theme="simple" cssStyle="width:155px;margin-left:5px;" id="bselect3"></s:select><SPAN class="note4">*</SPAN>
				     		</td>
				    	</tr>
				    	<tr>
				     		<td align="center"><input type="submit" name="btntj" class="link_input" id="btnSubmit1" value="提 交" onclick="return fnSubmit();"></td>
				    	</tr>
				   	</tbody>
			  	</table>
				<input type="hidden" name="corpId" value="${corp.id }">
			</form>
		</div>
	</div>
  </body>
  <s:if test="%{tip!=null}">
	<script>
		alert('${tip}');
		fnSearch();
	</script>
  </s:if>
</html>
